package b649a01.poperators;

import java.util.Hashtable;

import b649a01.runners.sim_p;

/***
 * Integer arithmetic calculator.
 * 
 * @author Chao Sun
 * @version 1.0
 */
public class noop extends calculator {
	
	/**
	 * Constructor.
	 */
	public noop(sim_p sim, int i, int j, String op) {
		super(sim, i, j, op);
		Hashtable<String, Integer> cycleHash = simulator.getcycleHash();
		this.cycleNum = cycleHash.get(op);
	}
	
	/**
	 * Execute an arithmetic instruction. Remove computing unit lock.
	 */
	@Override
	public void execute() {
		if (!finishFlag) {
			finishFlag = true;
		}

		cycleNum--;
	}
	
	/**
	 * Write results into register. Remove write locks.
	 */
	@Override
	public void writeBack() {
		aliveFlag = false;
	}
}